#include <stdio.h>
#include <stdlib.h>

struct Node
{
    int data;
    struct Node* next;
} *top = NULL;

void push(int x)
{
    struct Node *p = (struct Node *)malloc(sizeof(struct Node));
    p->data = x;
    p->next = top;
    top = p;
}

void pop()
{
    if (top == NULL)
    {
        printf("Underflow!");
        return;
    }
    struct Node *p;
    p = top;
    top = top->next;
    printf("%d\n", p->data);
    free(p);
}

void peek()
{
    if (top == NULL)
    {
        printf("Empty!");
        return;
    }
    printf("%d\n", top->data);
}

void display()
{
    struct Node* q = top;
    if (top == NULL)
    {
        printf("Empty!");
        return;
    }
    while (q != NULL)
    {
        printf("%d ", q->data);
        q = q->next;
    }
    printf("\n");
}

int main()
{
    push(2);
    push(3);
    push(10);
    display();
    peek();
    pop();
    peek();
    display();
}